home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
FADER
/
FADE_IN.C
< prev
next >
Wrap
Text File
|
1991-03-01
|
3KB
|
144 lines
/* ===================================
File: Fade_In.c
Function: Handle all operations for this window
History: 3/1/91 Original by Prototyper.
================================= */
#include "Fade_In.h"
/* *********************************** */
/* These are the other includes for general routines */
#include "Strings.h"
extern char * strcpy(Str255 *, char *);
/* *********************************** */
#define TRUE 1
#define FALSE 0
#define NIL 0
/* *********************************** */
WindowPtr MyWindow;
static Rect tempRect,temp2Rect;
static short Index;
static ControlHandle CtrlHandle;
static Str255 sTemp;
static OSErr MyErr;
/* ====================================== */
/* Initialize us so all our routines can be activated */
void Init_Fade_In()
{
MyWindow = NIL;
}
/* ================================= */
/* Close our window */
void Close_Fade_In(whichWindow,theInput)
WindowPtr whichWindow;
TEHandle *theInput;
{
if ((MyWindow != NIL) && ((MyWindow == whichWindow) || (whichWindow == (WindowPtr)-1)))
{
DisposeWindow(MyWindow);
MyWindow = NIL;
}
}
/* ================================= */
/* ====================================== */
/* Update our window, someone uncovered a part of us */
void UpDate_Fade_In(whichWindow)
WindowPtr whichWindow;
{
WindowPtr SavePort;
if ((MyWindow != NIL) && (MyWindow == whichWindow))
{
GetPort(&SavePort);
SetPort(MyWindow);
DrawControls(MyWindow);
UpdatePict();
SetPort(SavePort);
}
}
/* ================================= */
/* Open our window and draw everything */
void Open_Fade_In(theInput)
TEHandle *theInput;
{
short Index;
Rect dataBounds;
Point cSize;
if (MyWindow == NIL)
{
MyWindow = GetNewWindow(1,NIL, (WindowPtr)-1);
SetPort(MyWindow);
ShowWindow(MyWindow);
SelectWindow(MyWindow);
InitPicts();
}
else
SelectWindow(MyWindow);
}
/* ================================= */
/* Handle action to our window, like controls */
void Do_Fade_In(myEvent, theInput)
EventRecord *myEvent;
TEHandle *theInput;
{
short RefCon;
short code;
short theValue;
WindowPtr whichWindow;
Point myPt;
ControlHandle theControl;
/* Start of Window handler */
if (MyWindow != NIL)
{
code = FindWindow(myEvent->where, &whichWindow);
if ((myEvent->what == mouseDown) && (MyWindow == whichWindow))
{
myPt = myEvent->where;
GlobalToLocal(&myPt);
}
if ((MyWindow == whichWindow) && (code == inContent))
{
code = FindControl(myPt, whichWindow, &theControl);
if (code != 0)
code = TrackControl(theControl,myPt, NIL);
}
}
}
/* ================================= */